Report Section

section adds a section or subsection to the report. Often it is very useful to set an ID for the section to be able to refer to this section later on in the script. It might necessary to add a result to a section created with TPTReport.add(section).

You can use section.setResult() or section.addResult(), where section is the name of your section. For example:

section.setResult(TPT.FAILED)

section.setResult(TPT.PASSED)

section.setResult(TPT.INCONCLUSIVE)

section.addReport(TPT.PASSED)

section.addReport(TPT.FAILED)

section.addReport(TPT.INCONCLUSIVE)

The difference between setReport() and addReport() is that addReport() finds the worst result set by you, and setReport() displays the last set result for the section. For example:

#report will display section1 as PASSED

section1.setReport(FAILED)

section1.setReport(PASSED)

#report will display section2 as FAILED

section2.addReport(FAILED)

section2.addReport(PASSED)

Example 1

Sections example

Example 2

The following example shows another way how to add subsections:

section = TPTReport.Section("Section")
subsection = TPTReport.Section("Subsection")
subsubsection = TPTReport.Section("Subsubsection")

#add subsections
section.add(subsection)
subsection.add(subsubsection)

#add sections to the report
TPTReport.add(section)

Subsection example

To set up the report section using a graphical user interface, see Assesslets - Report Section.